package com.zp.kidshop.shop.controller;

import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.zp.kidshop.common.constant.JSPLocationConst;
import com.zp.kidshop.common.controller.BaseController;
import com.zp.kidshop.common.util.LogUtil;
import com.zp.kidshop.shop.entity.User_User;
import com.zp.kidshop.shop.service.UserService;
/**
 * 
 * @Title: indexController.java
 * @Package com.zp.kidshop.shop.controller 
 * @Description: 网站首页
 * @author 张鹏  
 * @date 2017年3月27日 上午10:15:29 
 * @version V1.0
 */
@Controller
@RequestMapping("index")
public class indexController extends BaseController{
	
	@Resource
	private UserService userService;
	
	/**
	 * @Description: 首页
	 * @author 张鹏  
	 * @date 2017年3月27日 下午1:50:22 
	 * @version V1.0
	 */
	@RequestMapping("/index")
	public String index(@RequestParam Map<String,String> parMap,HttpServletRequest request,
			HttpServletResponse response,HttpSession session){
		
		return JSPLocationConst.INDEX;
	}
	
	/**
	 * @Description: 登录
	 * @author 张鹏  
	 * @date 2017年3月27日 下午1:50:28 
	 * @version V1.0
	 */
	@RequestMapping("/login")
	public String login(@RequestParam Map<String,String> parMap,HttpServletRequest request,
			HttpServletResponse response){
		parMap.put("username","11111111@qq.com");
		parMap.put("password","123456");
		User_User user = userService.login(parMap.get("username"), parMap.get("password"));
		
		LogUtil.addLog("[接口返回数据 ]:"+user);
		
		return JSPLocationConst.LOGIN;
	}
}
